package com.gla.Controller;

import com.gla.domain.Order;
import com.gla.result.Result;
import com.gla.service.EvaluationService;
import com.gla.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@CrossOrigin
@RequestMapping("/evaluation")
public class EvaluationController {

    @Resource
    EvaluationService evaluationService;
    @Autowired
    OrderService orderService;

    @GetMapping("/add")
    public Result add(Integer order_id, Integer ratting, String evaluation){
        //添加评价
        evaluationService.add(order_id,ratting,evaluation);
        //收货
        orderService.updateStatus(order_id, Order.EVALUATED);
        return Result.succeed();
    }
}
